﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Communergy.Common;
using Communergy.Repository.SQLite;

namespace Communergy.Repository
{
    public class SQLiteRepositoryFactory: IRepositoryFactory
    {
        #region IRepositoryFactory Members

        public IHistoricRepository CreateHistoricRepository(IUnitOfWork unitOfWork)
        {
            return new SQLiteHistoricRepository(unitOfWork);
        }

        public IMeterRepository CreateMeterRepository(IUnitOfWork unitOfWork)
        {
            return new SQLiteMeterRepository(unitOfWork);
        }

        public IRealtimeRepository CreateRealtimeRepository(IUnitOfWork unitOfWork)
        {
            return new SQLiteRealtimeRepository(unitOfWork);
        }

       

        public IUnitOfWork CreateUnitOfWork()
        {
            string connectionString = ConfigurationHelper.SqliteConnectionString(ConfigurationHelper.SQLLitePath);
            var sqlite = new CommunergySQLiteEntities(connectionString);
            return sqlite;
        }

        #endregion

    }
}
